﻿namespace TroubleshootingofBeanBagAssistant.lCheck
{
	public class SystemAgentCheck : IDiagnosticCheck
	{
		public string Name => "检查系统代理";

		public CheckResult Run()
		{
			string proxyInfo;
			if (SystemAagent.IsSystemProxyAbnormal(out proxyInfo))
			{
				SystemAagent.RestoreSystemProxy();
				return new CheckResult
				{
					Title = "检测到系统代理异常，已自动恢复",
					Detail = $"原代理: {proxyInfo}"
				};
			}
			else
			{
				return new CheckResult
				{
					Title = "代理正常",
					Detail = $"原代理: {proxyInfo}"
				};
			}
		}
	}
}
